<template>
  <RkContainer :isFooter="false"
    :isAside=false>
    <template #header_left>
      <RkButtonGroup :options="json_review_proj_button"
        v-model="queryParams.reviewStatus"
        @click="handleSearch" />
    </template>
    <template #header_right>

    </template>
    <template #main>
      <RkCenter>
        <template #content>
          <rk-grid ref="projMangementRef"
            title="项目信息列表"
            dataUrl="/reviewApply/page"
            :boxConfig="false"
            :params="queryParams"
            :columns="queryParams.reviewStatus == 2 ? tableColumns : tableColumns.slice(0, -1)">
            <template #toolbar_title_buttons>
              <el-form-item label="来源"
                style="margin: 0">
                <rk-select :options="toArray(PROJ_TYPE_ENUMS)"
                  v-model="queryParams.type"
                  @change="handleSearch"
                  :clearable="false"
                  :is-search="false"
                  style="width: 120px;height: 30px"></rk-select>
              </el-form-item>
              <el-form-item style="margin: 0 10px">
                <el-input v-model="queryParams.projectName"
                  placeholder="请输入项目名称"
                  class="mr-15px w-200px"
                  clearable
                  @blur="handleSearch">
                </el-input>
              </el-form-item>
              <el-form-item style="margin: 0px">
                <AdTreeSelect v-model="queryParams.adCode"
                  placeholder="请选择区划"
                  style="width: 250px;"
                  @change="handleSearch">
                </AdTreeSelect>
              </el-form-item>
            </template>
            <!--                        <template #proj-review-report="{row,column}">-->
            <!--                            <a class="yhs-pro-name" href="javascript:;"-->
            <!--                               @click="handleOpenDialog(row,column)">{{ row[column.field] }}</a>-->
            <!--                        </template>-->
            <template #operation="{ row }">
              <div class="operation-box">
                <el-button type="primary"
                  link
                  @click.stop="handleOpenDialog(row)">预览
                </el-button>
              </div>
            </template>
          </rk-grid>
        </template>
      </RkCenter>
    </template>
    <proj-management-preview ref="previewRef" />
    <!--    <proj-expert-review-log v-model:visible="visible"></proj-expert-review-log>-->
  </RkContainer>
</template>
<script setup>

import { json_review_proj_button } from '@/common/button-data.js'
import { computed, getCurrentInstance, nextTick, onMounted, reactive, ref } from 'vue'
import { toArray } from '@/enums/enums-common';
import { PROJ_TYPE_ENUMS } from '@/enums/enums-project';
// import ProjectExpertDialog from "@/views/expert/task-management/dialogs/ProjectExpertDialog.vue";
// import ReviewReportDrawer from "@/views/project/bond/drawer/ReviewReportDrawer.vue";
import { useUserStore } from '@/stores/modules';
import { useRoute } from "vue-router";
import ProjManagementPreview from "@/views/expert/proj-management/dialog/ProjManagementPreview.vue";

const userInfo = useUserStore().userInfo

const { appContext } = getCurrentInstance();
const globalProxy = appContext.config.globalProperties;
const projMangementRef = ref(null)
// const visible = ref(false)
const previewRef = ref(null)
const route = useRoute()

// 查询参数
let queryParams = reactive({
  adCode: userInfo.adCode,
  nodeId: route.query.nodeId,
  projectName: void 0,
  reviewStatus: parseInt(history.state.wfStatus) || 0,
  type: '0'
})

const tableColumns = ref([
  { field: 'adName', title: '地区', width: 150, align: 'left' },
  { field: 'agencyName', title: '单位', width: 180, align: 'left' },
  { field: 'proCode', title: '项目编码', width: 200, align: 'left', },
  { field: 'proName', title: '项目名称', width: 250, align: 'left', cellRender: { name: 'xmYHS' } },
  { field: 'proSourceName', title: '项目来源', width: 150, align: 'center', },
  { field: 'fundInvestAreaName', title: '项目投向领域', width: 200, align: 'left' },
  { field: 'proTypeName', title: '项目类型', width: 150, align: 'left' },
  { field: 'remark', width: 150, title: '备注', align: 'left' },
  {
    field: 'operation',
    title: '评审报告',
    width: 120,
    fixed: 'right',
    align: 'center',
    showOverflow: true,
    slots: { default: 'operation' }
  }])

const handleSearch = () => {
  projMangementRef.value.searchEvent()
}
const handleOpenDialog = (row, column) => {
  previewRef.value.handleOpen(row)
}
onMounted(() => {

})

</script>

<style lang="scss" scoped>
.mr-15px {
	margin-right: 15px;

	&:last-child {
		margin-right: 0;
	}
}

.w-200px {
	width: 200px;
}
</style>
